package com.ly.cloud.api;

import com.ly.cloud.api.factory.SysBaseAPIFallbackFactory;
import com.ly.common.core.bean.R;
import com.ly.common.core.bean.dto.MsgDTO;
import com.ly.common.core.constant.SystemConstant;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Set;

/**
 * 系统服务-feign
 */
@FeignClient(contextId = "sysBaseRemoteApi", value = SystemConstant.SERVICE_SYSTEM, fallbackFactory = SysBaseAPIFallbackFactory.class)
@ConditionalOnMissingClass("com.ly.system.system.service.impl.SysBaseApiImpl") //有实现类的时候，不实例化Feign接口
public interface ISysBaseAPI {

    /**
     * 系统消息
     */
    @PostMapping("/sys/api/sendMsg")
    void sendMsg(@RequestBody MsgDTO dto);

    /**
     * 用户角色
     *
     * @param userId
     * @return
     */
    @GetMapping("/sys/api/getUserRoleSetById")
    Set<String> getUserRoleSetById(@RequestParam("userId") String userId);

    /**
     * 用户权限
     *
     * @param userId
     * @return
     */
    @GetMapping("/sys/api/getUserPermissionSet")
    Set<String> getUserPermissionSet(@RequestParam("userId") String userId);

    /**
     * 获取租户
     *
     * @param id
     * @return
     */
    @GetMapping("/sys/api/getTenantById")
    R getTenantById(@RequestParam("id") String id);
}
